package data.visu.structures;

/**
 * @author Charles Perin
 * 29 mars 2011
 * LIMSI - INRIA Rennes
 * charles.perin@free.fr
 *
 */
public class PairOfDouble implements Comparable<Object> {

	protected double min;
	protected double max;

	public PairOfDouble(double min, double max) {
		if (min <= max) {
			this.min = min;
			this.max = max;
		}
	}

	public void setMin(int min) {
		if (min < this.max) {
			this.min = min;
		}
	}

	public double getMin() {
		return this.min;
	}

	public void setMax(int max) {
		if (max > this.min) {
			this.max = max;
		}
	}

	public double getMax() {
		return this.max;
	}

	public String toString() {
		return "(min:" + this.min + " , max:" + this.max +")";
	}
	
	@Override
	public boolean equals(Object o){
		PairOfDouble pod = (PairOfDouble) o;
		if(pod.getMin()==this.min && pod.getMax()==this.max)return true;
		return false;
	}

	@Override
	public int compareTo(Object o) {
		double compMin = ((PairOfDouble) o).getMin();
		return (int)(this.min - compMin);
	}
}
